/*************************************************************************
	> File Name: monolith/interface/sql/sql_base.h
	> Author: dzhang
	> Mail: dong.zhang@ingenic.com 
	> Created Time: Thu 04 Feb 2021 10:33:07 AM CST
 ************************************************************************/

#ifndef _MONOLITH_INTERFACE_SQL_SQL_BASE_H_
#define _MONOLITH_INTERFACE_SQL_SQL_BASE_H_
#pragma once
#include <iostream>
#include <vector>
#include "monolith/core/macros.h"
#include "SQLiteCpp/SQLiteCpp.h"
#include "SQLiteCpp/VariadicBind.h"

CC_NAME_SPACE_BEGIN
namespace sql {

class SQLBase {
public:
    int open(std::string db_file);

    int close();

public:
    int exec(const char* apQueries);
    int exec(const std::string& aQueries);

    SQLite::Column execAndGet(const char* apQuery);
    SQLite::Column execAndGet(const std::string& apQuery);

    std::vector<SQLite::Column> query(const char* apQuery);
    std::vector<SQLite::Column> query(const std::string& apQuery);

protected:
    SQLite::Database* db_ = nullptr;
};

} // namespace sql
CC_NAME_SPACE_END

#endif //_MONOLITH_INTERFACE_SQL_SQL_BASE_H
